package com.albaba.designpattern.factory.text_002.factory;

import com.albaba.designpattern.factory.text_001.service.DiscountService;
import com.albaba.designpattern.factory.text_001.service.SmallGiftService;
import com.albaba.designpattern.factory.text_001.service.YouKuMemberService;
import com.albaba.designpattern.factory.text_002.service.IFreeGoods;
import com.albaba.designpattern.factory.text_002.service.impl.DiscountFreeGoodServiceImpl;
import com.albaba.designpattern.factory.text_002.service.impl.SmallGiftFreeGoodServiceImpl;
import com.albaba.designpattern.factory.text_002.service.impl.YouKuMemberFreeGoodServiceImpl;

/**
 * @Description: 具体工厂：生成免费商品
 * @Author zx
 * @Date 2025/2/19 11:26
 * @Version 1.0
 */
public class FreeGoodsFactory {

    public static IFreeGoods getInstance(Integer awardType) {

        IFreeGoods iFreeGoods = null;

        switch (awardType) {
            case 1:
                // 打折券
                return iFreeGoods = new DiscountFreeGoodServiceImpl();
            case 2:
                // 优酷会员
                return iFreeGoods = new YouKuMemberFreeGoodServiceImpl();
            case 3:
                // 小礼品
                return iFreeGoods = new SmallGiftFreeGoodServiceImpl();
            default:
                return null;


        }
    }
}
